import Vue from "vue";
import VueRouter from "vue-router";
// import HomeView from "../views/HomeView.vue";
import Layout from "../views/layout";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "Login",
    hidden: true,
  },
  {
    path: "/login",
    name: "Login",
    hidden: true,
    meta: {
      title: "登录",
    },
    component: () => import("../views/login"),
  },
  {
    path: "/home",
    name: "Home",
    meta: {
      title: "控制台",
    },
    component: Layout,
    redirect: "consoleIndex",
    children: [
      {
        path: "/consoleIndex",
        name: "ConsoleIndex",
        meta: {
          title: "首页",
        },
        component: () => import("../views/console/index.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  // mode: "history",
  mode: process.env.IS_ELECTRON ? "hash" : "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
